import store from "@/store";
import {
	getStorage
} from "./auth";
export function getWxLoginCode() {
	return new Promise((resolve, reject) => {
		wx.login({
			timeout: 10 * 1000,
			success: (res) => {
				if (res.code) {
					resolve(res.code);
				} else {
					uni.showToast({
						title: '获取登录信息失败',
						mask: true
					})
					reject()
				}
			},
			fail: () => {
				uni.showToast({
					title: '获取登录信息失败',
					mask: true
				})
				reject()
			}
		})
	})
}
/**
 * @description 判断是否登录
 * @returns {boolean}
 */
export function isLogin() {
	return !!store.getters.user;
}